package textfileproces;

import java.io.IOException;

/**
 * Writes a new file by removing quotations from the input file.
 */
public class RemoveQuotations extends FileConversion {

    // Constants
	private final String QUOTATIONS_STRING = "\"";

	// Constructor
    public RemoveQuotations(String inputFileName, String outputFileName) 
    		throws IOException {
    	super(inputFileName, outputFileName);
    }

    // Methods
    /** Performs the operation creating a new file called 'outputFileName'. */
	public void run() {
		getCharset();
		try {
			createReaderAndWriter();
		    String line = null;
		    while ((line = reader.readLine()) != null) {
		    	String newLine = line.replaceAll(QUOTATIONS_STRING, "");
		    	writer.write(newLine);
		    	writer.newLine();
		    }
		    reader.close();
		    writer.close();
		} catch (IOException exception) {
		    System.err.format("IOException: %s%n", exception);
		    status = -1;
		}
	}

}
